package cn.stu.lqj.demo.controller;

import cn.stu.lqj.demo.pojo.Emp;
import cn.stu.lqj.demo.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/emp")
public class EmpController {

    @Autowired(required = false)
    private EmpService empService;

    @RequestMapping("/findAllEmps")
    public String findAllEmps(Model model){
//        System.out.println(model+"-------------------");
        return empService.findAllEmp(model);
    }

    @RequestMapping("/findAllHistoriaEmp")
    public String findAllHistoriaEmp(Model model){
//        System.out.println(model+"-------------------");
        return empService.findAllHistoriaEmp(model);
    }
    @RequestMapping("/deleteById")
    public String deleteById(Integer id){
//        System.out.println(id+"Control-------------------");
        return empService.deleteById(id);
    }
    @RequestMapping("/toUpdateByEmpId")
    public String toUpdateByEmpId(Integer id,Model model){
//        System.out.println(id+"Control-------------------");
        return empService.toUpdateByEmpId(id,model);
    }
    @RequestMapping("/updateByEmpId")
    public String updateByEmpId(Emp emp){
//        System.out.println(id+"Control-------------------");
        return empService.updateByEmpId(emp);
    }
//    @RequestMapping("/findDetailById")
//    public String findDetailById(Integer empId,Model model){
////        System.out.println(id+"Control-------------------");
//        return empService.findDetailById(empId,model);
//    }
}
